home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Tele / T / Tabby_LAUNCH.bas next >
Encoding:
BASIC Source File  |  1990-02-25  |  4.7 KB  |  152 lines  |  [TEXT/MACA]

  1. "Tabby_Launch"
  2.  
  3.      ' COMMENTS
  4.      ' Last Modified, by Michael Lininger on 12-22-89.
  5.  
  6.      ' This sub-routine reads in the launch.next file from the disk and
  7.      ' determines the next application to be launched.  If it is not the last
  8.      ' application in the chain a new launch.next file is written to the
  9.      ' disk for the next application to use, after it has been launched.
  10.      ' If it is the last application in the chain then the launch.next file
  11.      ' is deleted from the disk.
  12.      ' This routine is over-kill and can be simplified.
  13.  
  14.      ' ----- End Comment
  15.  
  16.      RESET: ' Make sure all file are closed
  17.      EventCount%=0: ' sets the number of events in launch.next to 0
  18.      ErrCode%=3:    ' sets Export error code (03 deals with Launch.next)
  19.      ERROR = 0:     ' sets ERROR bit to Zero/No error has occured
  20.      LErr% = 1:     ' tell ERROR_Check that we are in the tabby_launch area
  21.  
  22.      ' Make sure a Lunch.next file exists
  23.      ON ERROR GOSUB 65535: ' We do our own error trapping
  24.      OPEN "R",1,NextLaunch$
  25.           Length&=LOF(1,1)
  26.      CLOSE #1
  27.  
  28.      ' If Launch.next file does not exist then jump to Launch_RRH Routine
  29.      LONG IF Length&=0
  30.           ErrLine$ = "<<Warning 01>> *"+NextLaunch$+"* Does not exist at end of Indicated Path! "
  31.           GOSUB "Error Log"
  32.           KILL NextLaunch$
  33.           GOTO "Launch_RRH"
  34.      END IF
  35.  
  36.      ' Read in event chain into Tabby$()
  37.      OPEN "I",1,NextLaunch$
  38.      WHILE NOT EOF(1)
  39.           GOSUB "Cursor_Spin"
  40.           INPUT #1,Tabby$(EventCount%)
  41.           EventCount%=EventCount%+1
  42.      WEND
  43.      CLOSE #1
  44.  
  45.      ' If ERROR <> 0 then there was a problem with reading the Launch.next file
  46.      IF ERROR <> 0 THEN GOSUB "ERROR_Check"
  47.  
  48.      GOSUB "Cursor_Spin"
  49.      EventCount%=EventCount%-1
  50.      ERROR = 0:     ' sets ERROR bit to Zero/No error has occured
  51.  
  52.      ' If EventCount% = 0 then this is the last event, delete Launch.next file
  53.      ' Else write Launch.next file back to disk, minus the first event which
  54.      ' is going to be launched next.
  55.      LONG IF EventCount% < 1
  56.           ErrCode%=4:    ' sets Export error code (Launch.next Delete)
  57.           KILL NextLaunch$
  58.      XELSE
  59.           ErrCode%=5:    ' sets Export error code (New lanuch.next Creation)
  60.           OPEN "O",1,NextLaunch$
  61.           FOR Count% = 1 TO EventCount%
  62.               PRINT #1,Tabby$(Count%);
  63.               GOSUB "Cursor_Spin"
  64.               LONG IF Tabby$(Count%+1) = ""
  65.                    PRINT #1,CHR$(13);
  66.               XELSE
  67.                    PRINT #1,",";
  68.               END IF
  69.           NEXT Count%
  70.           CLOSE #1
  71.      END IF
  72.  
  73.      ' If ERROR <> 0 then there was a problem writing/deleting launch.next file
  74.      IF ERROR <> 0 THEN GOSUB "ERROR_Check"
  75.  
  76.      ' Add BBS path to application to be launched
  77.      ' If the Next Event = "BBS" then next file to launch to Red Ryder Host RRHost$
  78.      LaunchFile$=BBSPath$+Tabby$(0)
  79.      IF UCASE$(Tabby$(0)) = "BBS" THEN LaunchFile$=RRHost$
  80.  
  81.  
  82.      ERROR = 0:     ' sets ERROR bit to Zero/No error has occured
  83.      ErrCode%=6:    ' sets Export error code (06 deals with next launch application)
  84.  
  85.      ' Checks to see if LaunchFile exists
  86.      OPEN "I",2,LaunchFile$
  87.      CLOSE #2
  88.      ' If it does exist then launch it     
  89.      LONG IF ERROR = 0 THEN 
  90.           RUN LaunchFile$
  91.           END: ' A must if you run under MultiFinder
  92.      END IF
  93.      ErrLine$ = "<<ERROR"+STR$(ERROR)+">> *"+LaunchFile$+"* Does not exist at end of Indicated Path! "
  94.      GOSUB "Error Log"
  95.  
  96. "Launch_RRH"
  97.  
  98.      ERROR = 0:     ' sets ERROR bit to Zero/No error has occured
  99.      ErrCode%=7:    ' sets Export error code (07 deals with launching RRHost/SS
  100.      
  101.      ' Checks to see if RRHost exists
  102.      OPEN "I",2,RRHost$
  103.      CLOSE #2
  104.      ' If it does exist then launch it
  105.      LONG IF ERROR = 0
  106.           RUN RRHost$
  107.           END: ' a must if you run under MultiFinder
  108.      END IF
  109.  
  110.      ' last chance, RRHost launch failed, drop to finder
  111.      ErrLine$ = "<<ERROR"+STR$(ERROR)+">> *"+RRHost$+"* Does not exist at end of Indicated Path! "
  112.      GOSUB "Error Log"
  113.      END
  114.     
  115.      RETURN
  116.  
  117.  
  118.  
  119. "ERROR_Check"
  120.  
  121.      GOSUB "Error Log"
  122.      ' LErr% is a multi-purpose flag, used by various routines
  123.      ' If it is set to 1 then that means the error occurred in the
  124.      ' Tabby_Launch routine it set and there is no way to recover
  125.      ' Except to attempt to run RRHOST and END.
  126.      LONG IF LErr%=1
  127.           RUN RRHost$
  128.           END: ' A must if you run under MultiFinder
  129.      END IF
  130.      GOSUB "Tabby_Launch"
  131.      END
  132.    
  133.      RETURN
  134.  
  135.  
  136. "Error Log"
  137.  
  138.      ' Writes a text file, listing the Error that happended
  139.      ErrHold%=ERROR
  140.      DEF OPEN "TEXTEDIT"
  141.      OPEN "A",9,"Application.Error"
  142.           ErrLine$="<<ERROR"+STR$(Errhold%)+","+STR$(ErrCode%)+">> internal application problem "+TIME$+" "+DATE$
  143.           PRINT #9,ErrLine$
  144.       CLOSE #9
  145.       RETURN
  146.      
  147.  
  148.  
  149.  
  150.  
  151.  
  152.